#!/bin/bash

ext=`echo $1 | cut -d. -f2`
if [ $ext != 'h' ]
then
  file=$1.h
else
  file=$1
fi

echo "/**@file $file"
echo " * @author $2"
year=`date | sed 's_[ ][ ]*_-_g' | cut -d- -f6`
mon=`date | sed 's_[ ][ ]*_-_g' | cut -d- -f2`
day=`date | sed 's_[ ][ ]*_-_g' | cut -d- -f3`
if [ ${#day} -lt 2 ]
then
    day=0$day
fi
cur_date="$day-$mon-$year"
echo " * @date $cur_date" 
echo " */"

printf "\n"
label=`echo $file | sed 'y/abcdefghijklmnopqrstuvwxyz./ABCDEFGHIJKLMNOPQRSTUVWXYZ_/'`
label=_"$label"_
echo "#ifndef $label"
echo "#define $label"

printf "\n"
echo "#include \"tz_cdefs.h\""
printf "\n"
echo "__BEGIN_DECLS"
printf "\n"
echo "__END_DECLS"

printf "\n"
echo '#endif'
